import * as React from 'react';
import { createElement } from 'react';
import { BaseWrapper } from '../base';
import './fieldSelect.less';
import { useFormContainerSelector } from '../../form-container';
import { BaseFieldSelect } from './base-field-select';

export interface FieldSelectProps {
  max: string;
}

export const FieldSelect: React.FC<FieldSelectProps> = function FieldSelect(props) {
  const [readonly] = useFormContainerSelector((s) => [s.readonly]);
  const { columnConfig } = props;

  return (
    <BaseWrapper {...props}>
      <BaseFieldSelect
        {...props}
        innerProps={{
          disabled: readonly || columnConfig?.status === '2',
        }}
      />
    </BaseWrapper>
  );
};
